if (window == top) {
  selectionText();
  window.addEventListener("mouseup", selectionText);
}

function selectionText() {
	document.addEventListener("mouseup",function(a){
		myport=chrome.extension.connect({name:"sendlink"});
		myport.postMessage({message:"select",txt:""+window.getSelection()});
		},
		false);
}